package com.ex.question.base;

public abstract class ShapeQuestion extends BaseQuestion {
	/*
	 * 正确面积
	 */
	protected double mArea;
	/*
	 * 正确周长
	 */
	protected double mPerimeter;
	/*
	 * 回答的周长
	 */
	double mPerimeterAnswer;
	/*
	 * 回答的面积
	 */
	double mAreaAnswer;
	boolean mIsRightArea;
	boolean mIsRightPerimeter;
	String mShapeName;

	public ShapeQuestion() {
		mArea = -1;
		mPerimeter = -1;
		mAreaAnswer = -1;
		mPerimeterAnswer = -1;
		mShapeName = "未知图形";
		mQuestionTypeName = "未知图形面积计算";
	}

	protected void CalcArea() {
		mArea = 0;
	}

	protected void CalcPerimeter() {
		mPerimeter = 0;
	}

	/**
	 * 获取图形的正确周长.
	 */
	public double getRightArea() {
		return mArea;
	}

	public double getRightPerimeter() {
		return mPerimeter;
	}

	/**
	 * 设置面积 答案、
	 * 
	 * @param area
	 *            面积值
	 * @return 答案正确否,正确：true,错误：false。
	 */
	public boolean setAreaAnswer(double area) {
		this.mAreaAnswer = area;
		if (mArea == area)
			mIsRightArea = true;
		else
			mIsRightArea = false;

		return mIsRightArea;
	}

	/**
	 * 设置周长 答案、
	 * 
	 * @param perimeter
	 *            周长值
	 * @return 答案正确否,正确：true,错误：false。
	 */
	public boolean setPerimeterAnswer(double perimeter) {
		this.mPerimeterAnswer = perimeter;
		if (mPerimeter == perimeter)
			mIsRightPerimeter = true;
		else
			mIsRightPerimeter = false;

		return mIsRightPerimeter;
	}

	/**
	 * 是否回答周长.
	 * 
	 * @return 是否回答， 回答 true， 未答 false.
	 */
	public boolean AnseweredArea() {
		if (this.mAreaAnswer == -1)
			return false;
		else
			return true;
	}

	/**
	 * 是否回答周长. 
	 * @return 是否回答， 回答 true， 未答 false.
	 */

	public boolean AnseweredPerimeter() {
		if (this.mPerimeterAnswer == -1)
			return false;
		else
			return true;
	}

	public String getShapeName() {
		return mShapeName;
	}
}
